#!/usr/bin/env node

const ORM = require('@datawrapper/orm');
const config = require('../src/config');

ORM.init(config).then(function() {
	const task = process.argv[2];
	const sub = process.argv[3] || false;

	const mod = require(`../src/tasks/${task}`);

	if (sub) mod[sub](); else mod();

	setTimeout(() => {
	    ORM.db.close();
	}, 100);
});

